class.
wpt_tmp->notes = xstrdup(rec->comment);
wpt_tmp->description = xstrdup(rec->name);
if (rec->url) {
- wpt_tmp->url = xstrdup(rec->url);
+ UrlLink l(rec->url);
+ wpt_tmp->AddUrlLink(l);
} else if (NULL != (url=strstr(wpt_tmp->description, "{URL="))) {
*url = '\0';
url += 5;
url[strlen(url)-1] = '\0';
- wpt_tmp->url = xstrdup(url);
+ UrlLink l(url);
+ wpt_tmp->AddUrlLink(l);
}
if (rec->image_name) {
xfree(extra);
}
- if (!nourl && wpt->hasLink()) {
- int len = 7 + wpt->url.length();
+ if (!nourl && wpt->HasUrlLink()) {
+ UrlLink l = wpt->GetUrlLink();
+ int len = 7 + l.url_.length();
char* extra = (char*)xmalloc(len);
- sprintf(extra, "{URL=%s}", wpt->url.toUtf8().data());
+ sprintf(extra, "{URL=%s}", l.url_.toUtf8().data());
rec->name = xstrappend(rec->name, extra);
xfree(extra);
- rec->url = xstrdup(wpt->url.toUtf8().data());
+ rec->url = xstrdup(l.url_.toUtf8().data());
}
if (wpt->notes) {
{
waypoint* w = (waypoint*)wpt;
format_specific_data* fs;
- url_link* url_next;
geocache_data* gc_data = (geocache_data*)wpt->gc_data;
if ((cet_output == 0) && (w->wpt_flags.cet_converted != 0)) {
w->description = cet_convert_string(wpt->description);
w->notes = cet_convert_string(wpt->notes);
- const char*url = cet_convert_string(wpt->url);
- const char*url_link_text = cet_convert_string(wpt->url_link_text);
- w->url = url;
- w->url_link_text = url_link_text;
- xfree(url);
- xfree(url_link_text);
-
- for (url_next = w->url_next; url_next; url_next = url_next->url_next) {
- url_next->url = cet_convert_string(url_next->url);
- url_next->url_link_text = cet_convert_string(url_next->url_link_text);
- }
if (gc_data) {
const char *placer = cet_convert_string(gc_data->placer);
const char *hint = cet_convert_string(gc_data->hint);
if (wpt->shortname != NULL) {
waypt_add(waypt_dupe(wpt));
-#if 0
- if (wpt->url != NULL) {
- xfree(wpt->url);
- wpt->url = NULL;
- }
-#else
- wpt->url.clear();
-#endif
+ // Rather than creating a new waypt on each read, tis format bizarrely
+ // recycles the same one, relying on waypt_dupe() above and then manually
+ // resetting fields. Weird.
+ wpt->url_link_list_.clear();
if (temp_route == NULL) {
temp_route = route_head_alloc();
if (strncmp(cin + 2, "bitmap", 6) == 0) {
cin = lrtrim(cin + 8);
if (*cin != '\0') {
- wpt->url = cst_make_url(cin);
+ UrlLink l(cst_make_url(cin));
+ wpt->AddUrlLink(l);
}
}
}
}
-#if 0
-static void
-cst_wr_init(const char* fname)
-{
- fout = gbfopen(fname, "w", MYNAME);
-}
-
-static void
-cst_wr_deinit(void)
-{
- gbfclose(fout);
-}
-
-static void
-cst_route_hdr(const route_head* rte)
-{
-}
-
-static void
-cst_route_tlr(const route_head* rte)
-{
-}
-
-static void
-cst_write_wpt(const waypoint* wpt)
-{
-}
-
-static void
-cst_data_write(void)
-{
-}
-#endif
-
ff_vecs_t cst_vecs = {
ff_type_file,
{ ff_cap_read, ff_cap_read, ff_cap_read },
static route_head* csv_track, *csv_route;
static double utm_northing, utm_easting, utm_zone = 0;
static char utm_zonec;
+static UrlLink* link_;
#endif // CSVFMTS_ENABLED
wpt->notes = csv_stringtrim(s, "", 0);
break;
case XT_URL:
- wpt->url = QString(s).trimmed();
+ if (!link_) link_ = new UrlLink;
+ link_->url_ = QString(s).trimmed();
break;
case XT_URL_LINK_TEXT:
- wpt->url_link_text = QString(s).trimmed();
+ if (!link_) link_ = new UrlLink;
+ link_->url_link_text_ = QString(s).trimmed();
break;
case XT_ICON_DESCR:
wpt->icon_descr = QString(s).trimmed();
DATUM_WGS84);
}
+ if (link_) {
+ wpt_tmp->AddUrlLink(*link_);
+ delete link_;
+ link_ = NULL;
+ }
+
switch (xcsv_file.datatype) {
case unknown_gpsdata:
case wptdata:
strcpy(buff, xcsv_urlbase);
off = strlen(xcsv_urlbase);
}
- if (wpt->hasLink()) {
- snprintf(buff + off, sizeof(buff) - off, fmp->printfc, wpt->url.toUtf8().data());
+ if (wpt->HasUrlLink()) {
+ UrlLink l = wpt->GetUrlLink();
+ snprintf(buff + off, sizeof(buff) - off, fmp->printfc, l.url_.toUtf8().data());
} else {
strcpy(buff, (fmp->val && *fmp->val) ? fmp->val : "\"\"");
}
}
break;
- case XT_URL_LINK_TEXT:
+ case XT_URL_LINK_TEXT:
+ if (wpt->HasUrlLink()) {
+ UrlLink l = wpt->GetUrlLink();
snprintf(buff, sizeof(buff), fmp->printfc,
- (wpt->hasLinkText()) ? wpt->url_link_text.toUtf8().data() : fmp->val);
+ !l.url_link_text_.isEmpty() ? l.url_link_text_.toUtf8().data() : fmp->val);
+ }
break;
case XT_ICON_DESCR:
writebuff(buff, fmp->printfc,
#include "inifile.h"
#include "session.h"
+#include <Qtcore/QString>
#include <QtCore/QDebug>
+
# include "src/core/datetime.h"
// Turn on Unicode in expat?
/*
* Structures and functions for multiple URLs per waypoint.
*/
-class url_link {
- public:
- url_link() :
- url_next(NULL)
- {} ;
- url_link* url_next;
- QString url;
- QString url_link_text;
+
+class UrlLink {
+ public:
+ UrlLink() { }
+ UrlLink(QString url) :
+ url_(url)
+ { }
+ UrlLink(QString url, QString url_link_text) :
+ url_(url),
+ url_link_text_(url_link_text)
+ { }
+ QString url_;
+ QString url_link_text_;
};
+
/*
* Misc bitfields inside struct waypoint;
*/
shortname(NULL),
description(NULL),
notes(NULL),
- url_next(NULL),
route_priority(0),
hdop(0),
vdop(0),
*/
char* notes;
- /* This is a bit icky. Multiple waypoint support is an
- * afterthought and I don't want to change our data structures.
- * So we have the first in the waypoint itself and subsequent
- * ones in a linked list.
- * We also use an implicit anonymous union here, so these three
- * members must match struct url_link...
+ /* TODO: UrlLink should probably move to a "real" class of its own.
*/
- url_link* url_next;
- bool hasLink() const {return !url.isEmpty(); }
- bool hasLinkText() const {return !url_link_text.isEmpty(); }
- QString url;
- QString url_link_text;
+ QList<UrlLink> url_link_list_;
+ bool HasUrlLink() const {return !url_link_list_.isEmpty(); }
+ const UrlLink& GetUrlLink() const { return url_link_list_[0]; }
+ const QList<UrlLink> GetUrlLinks() const { return url_link_list_; }
+ void AddUrlLink(const UrlLink l) { url_link_list_.push_back(l); }
wp_flags wpt_flags;
QString icon_descr;
waypoint* wpt_tmp;
wpt_tmp = waypt_new();
+ UrlLink link;
for (tag = gbfgetc(file_in); tag != 0xff; tag = gbfgetc(file_in)) {
switch (tag) {
wpt_tmp->notes = gbfgetpstr(file_in);;
break;
case 6:
- wpt_tmp->url_link_text = gbfgetpstr(file_in);;
+ link.url_link_text_ = gbfgetpstr(file_in);;
break;
case 7:
wpt_tmp->icon_descr = gbfgetpstr(file_in);;
wpt_tmp->notes = gbfgetcstr(file_in);
break;
case 9: /* NULL Terminated (vs. pascal) link */
- wpt_tmp->url = gbfgetcstr(file_in);
+ link.url_ = gbfgetcstr(file_in);
break;
case 0x10:
- wpt_tmp->url_link_text = gbfgetcstr(file_in);
+ link.url_link_text_ = gbfgetcstr(file_in);
break;
case 0x63:
wpt_tmp->latitude = gbfgetdbl(file_in);
;
}
}
+ if (!link.url_.isEmpty() || !link.url_link_text_.isEmpty()) {
+ wpt_tmp->AddUrlLink(link);
+ }
waypt_add(wpt_tmp);
p = gbfgetc(file_in);
} while (!gbfeof(file_in) && (p == 'W'));
gbfputc(5, file_out);
gbfputpstr(wpt->notes, file_out);
}
- if (wpt->hasLinkText()) {
+ UrlLink link = wpt->GetUrlLink();
+ if (!link.url_link_text_.isEmpty()) {
gbfputc(6, file_out);
- gbfputpstr(wpt->url_link_text, file_out);
+ gbfputpstr(link.url_link_text_, file_out);
}
- if (wpt->hasLink()) {
+ if (!link.url_.isEmpty()) {
gbfputc(9, file_out);
- gbfputcstr(wpt->url, file_out);
+ gbfputcstr(link.url_, file_out);
}
gbfputc(0xff, file_out);
}
country = gt_get_icao_country(GMSD_GET(cc, ""));
print_string("%s\t", (country != NULL) ? country : "");
print_date_and_time(wpt->GetCreationTime(), 0);
- print_string("%s\t", wpt->hasLink() ? wpt->url : "");
+ if (wpt->HasUrlLink()) {
+ UrlLink l = wpt->GetUrlLink();
+ print_string("%s\t", l.url_);
+ } else {
+ print_string("%s\t", "");
+ }
print_categories(GMSD_GET(category, 0));
gbfprintf(fout, "\r\n");
wpt->creation_time = ct;
}
break;
- case 17:
- wpt->url = str;
+ case 17: {
+ UrlLink l(str);
+ wpt->AddUrlLink(l);
+ }
break;
case 18:
GMSD_SET(category, parse_categories(str));
xfree(temp);
}
- res->url = FREAD_CSTR_AS_QSTR;
+ QString linky = FREAD_CSTR_AS_QSTR;
+ UrlLink l(linky);
+ if (!linky.isEmpty()) {
+ res->AddUrlLink(l);
+ }
if (wpt_class != 0) {
- res->description = xstrdup(res->url.toUtf8().data());
- res->url.clear();
+ res->description = xstrdup(l.url_.toUtf8().data());
}
} else { // if (gdb_ver >= GDB_VER_3)
int i, url_ct;
FWRITE(zbuf, 3);
FWRITE(zbuf, 4);
+ QString ld;
+ if (wpt->HasUrlLink()) {
+ UrlLink l = wpt->GetUrlLink();
+ ld = l.url_;
+ }
descr = (wpt_class < gt_waypt_class_map_point) ?
- wpt->url : wpt->description;
+ ld : wpt->description;
if ((descr != NULL) && (wpt_class >= gt_waypt_class_map_point) && \
descr.compare(wpt->shortname) == 0) {
descr.clear();
FWRITE_CSTR(descr);
} else { /* if (gdb_ver > GDB_VER_3) */
int cnt;
- url_link* url_next;
+// url_link* url_next;
const char* str;
if (wpt_class < gt_waypt_class_map_point) { /* street address */
FWRITE_CSTR(str); /* instruction */
cnt = 0;
- if (wpt->hasLink()) {
- cnt++;
- }
- for (url_next = wpt->url_next; (url_next); url_next = url_next->url_next)
- if (!url_next->url.isEmpty()) {
- cnt++;
- }
+ cnt += wpt->url_link_list_.size();
FWRITE_i32(cnt);
- if (wpt->hasLink()) {
- FWRITE_CSTR(wpt->url);
+ foreach(UrlLink l, wpt->GetUrlLinks()) {
+ FWRITE_CSTR(l.url_.toUtf8().data());
}
- for (url_next = wpt->url_next; (url_next); url_next = url_next->url_next)
- if (!url_next->url.isEmpty()) {
- FWRITE_CSTR(url_next->url.toUtf8().data());
- }
}
FWRITE_i16(GMSD_GET(category, gdb_category));
rtrim(((waypoint*)refpt)->shortname);
test = gdb_find_wayptq(&wayptq_out, refpt, 1);
+ if (refpt->HasUrlLink() && test && test->HasUrlLink() && route_flag == 0) {
+ UrlLink orig_link = refpt->GetUrlLink();
+ UrlLink test_link = test->GetUrlLink();
+ if (orig_link.url_ != test_link.url_) {
+ test = NULL;
+ }
+ }
+
if ((test != NULL) && (route_flag == 0)) {
- if ((str_not_equal(test->notes, refpt->notes)) ||
- test->url.compare(refpt->url)) {
+ if (str_not_equal(test->notes, refpt->notes)) {
test = NULL;
}
}
wpt->icon_descr = reader.readElementText();
} else if (tag_name == "link") {
QXmlStreamAttributes a = reader.attributes();
- wpt->url_link_text = a.value("text").toString();
- wpt->url = reader.readElementText();
+ waypt_add_url(wpt,
+ reader.readElementText(), a.value("text").toString());
} else if (tag_name == "difficulty") {
wpt->gc_data->diff = reader.readElementText().toInt() * 10;
} else if (tag_name == "terrain") {
writer.writeTextElement("type", deficon ? deficon : waypointp->icon_descr);
- if (waypointp->hasLink()) {
+ if (waypointp->HasUrlLink()) {
writer.writeStartElement("link");
writer.writeAttribute("text ", "Cache Details");
- writer.writeCharacters(waypointp->url);
+ UrlLink link = waypointp->GetUrlLink();
+ writer.writeCharacters(link.url_);
writer.writeEndElement();
}
static QString current_tag;
static waypoint* wpt_tmp;
+static UrlLink* link_;
static int cache_descr_is_html;
static gbfile* fd;
static const char* input_fname;
const char** avp = &attrv[0];
wpt_tmp = waypt_new();
+ link_ = new UrlLink;
cur_tag = NULL;
while (*avp) {
* Waypoint-specific tags.
*/
case tt_wpt:
+ if (link_ && !link_->url_.isEmpty()) {
+ wpt_tmp->AddUrlLink(*link_);
+ delete link_;
+ link_ = NULL;
+ }
waypt_add(wpt_tmp);
logpoint_ct = 0;
cur_tag = NULL;
case tt_wpt_url:
case tt_trk_trkseg_trkpt_url:
case tt_rte_rtept_url:
- wpt_tmp->url = cdatastrp;
+ link_->url_ = cdatastrp;
break;
case tt_wpt_urlname:
case tt_trk_trkseg_trkpt_urlname:
case tt_rte_rtept_urlname:
- wpt_tmp->url_link_text = cdatastrp;
+ link_->url_link_text_ = cdatastrp;
break;
case tt_wpt_link:
//TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link:
lt = xstrdup(lrtrim(link_text));
}
- waypt_add_url(wpt_tmp, xstrdup(link_url), lt);
+ waypt_add_url(wpt_tmp, link_url, lt);
link_text = NULL;
}
break;
static void
write_gpx_url(const waypoint* waypointp)
{
- if (waypointp->url == NULL) {
+ if (!waypointp->HasUrlLink()) {
return;
}
if (gpx_wversion_num > 10) {
- url_link* tail;
- for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_next) {
+ foreach(UrlLink l, waypointp->GetUrlLinks()) {
writer.writeStartElement("link");
- writer.writeAttribute("href", tail->url);
- writer.writeOptionalTextElement("text", tail->url_link_text);
+ writer.writeAttribute("href", l.url_);
+ writer.writeOptionalTextElement("text", l.url_link_text_);
writer.writeEndElement();
}
return;
}
- writer.writeTextElement("url", QString(urlbase) + QString(waypointp->url));
- writer.writeOptionalTextElement("urlname", QString(waypointp->url_link_text));
+ UrlLink l = waypointp->GetUrlLink();
+ writer.writeTextElement("url", QString(urlbase) + QString(l.url_));
+ writer.writeOptionalTextElement("urlname", QString(l.url_link_text_));
}
/*
}
gbfprintf(file_out, "<br>\n");
if (strcmp(wpt->description, wpt->shortname)) {
- if (wpt->hasLink()) {
+ if (wpt->HasUrlLink()) {
char* d = html_entitize(wpt->description);
- gbfprintf(file_out, "<a href=\"%s\">%s</a>", wpt->url.toUtf8().data(), d);
+ UrlLink link = wpt->GetUrlLink();
+ gbfprintf(file_out, "<a href=\"%s\">%s</a>", link.url_.toUtf8().data(), d);
xfree(d);
} else {
gbfprintf(file_out, "%s", wpt->description);
writer->writeStartElement("name");
writer->writeCharacters("\n"); // FIXME forced formatting to match old references
- writer->writeCDATA(waypointp->url_link_text);
- writer->writeCharacters("\n"); // FIXME forced formatting to match old references
+ if (waypointp->HasUrlLink()) {
+ UrlLink link = waypointp->GetUrlLink();
+ writer->writeCDATA(link.url_link_text_);
+ writer->writeCharacters("\n"); // FIXME forced formatting to match old references
+ }
writer->writeEndElement(); // Close name tag
// Timestamp
kml_write_data_element("gc_num", waypointp->shortname);
}
- if (waypointp->hasLinkText()) {
- kml_write_data_element("gc_name", waypointp->url_link_text);
+ if (waypointp->HasUrlLink()) {
+ UrlLink link = waypointp->GetUrlLink();
+ kml_write_data_element("gc_name", link.url_link_text_);
}
if (!waypointp->gc_data->placer.isEmpty()) {
writer->writeOptionalTextElement("name", waypointp->shortname);
// Description
- if (waypointp->hasLink()) {
+ if (waypointp->HasUrlLink()) {
writer->writeEmptyElement("snippet");
- if (waypointp->hasLinkText()) {
- QString odesc = waypointp->url;
- QString olink = waypointp->url_link_text;
+ UrlLink link = waypointp->GetUrlLink();
+ if (!link.url_link_text_.isEmpty()) {
+ QString odesc = link.url_;
+ QString olink = link.url_link_text_;
writer->writeStartElement("description");
writer->writeCDATA(QString("<a href=\"%1\">%2</a>").arg(odesc, olink));
writer->writeEndElement(); // Close description tag
} else {
- writer->writeTextElement("description", waypointp->url);
+ writer->writeTextElement("description", link.url_);
}
} else {
if (strcmp(waypointp->shortname, waypointp->description)) {
}
lmx_end_tag(0x4A, 3); // coordinates
- if (wpt->hasLink()) {
+ if (wpt->HasUrlLink()) {
lmx_start_tag(0x65, 3); // mediaLink
if (!binary) {
gbfputc('\n', ofd);
}
- if (wpt->hasLinkText()) {
- lmx_write_xml(0x48, wpt->url_link_text, 4); // name
+ UrlLink link = wpt->GetUrlLink();
+ if (!link.url_link_text_.isEmpty()) {
+ lmx_write_xml(0x48, link.url_link_text_, 4); // name
}
- lmx_write_xml(0x67, wpt->url, 4); // url
+ lmx_write_xml(0x67, link.url_, 4); // url
lmx_end_tag(0x65, 3); // mediaLink
}
cx = lrtrim(xstrndup(cx, cend - cx));
if (*cx) {
- wpt->url = cx;
+ UrlLink l(cx);
+ wpt->AddUrlLink(l);
} else {
xfree(cx);
}
wpt->notes = xstrdup(cend);
}
- if (wpt->hasLink()) {
+ if (wpt->HasUrlLink()) {
DBG((sobj, "url = \"%s\"\n", wpt->url));
}
} else if (*str) {
if (wpt2->notes) {
wpt->notes = xstrdup(wpt2->notes);
}
- if (wpt2->hasLink()) {
- wpt->notes = xstrdup(wpt2->url.toUtf8().data());
+ if (wpt2->HasUrlLink()) {
+ UrlLink l = wpt2->GetUrlLink();
+ wpt->notes = xstrdup(l.url_.toUtf8().data());
}
wpt->proximity = wpt2->proximity;
gbfputuint16(0, fout); /* extra bytes */
}
- if (wpt->hasLink()) {
+ if (wpt->HasUrlLink()) {
str = xstrdup("_FILE_ ");
- str = xstrappend(str, wpt->url.toUtf8().data());
+ UrlLink l = wpt->GetUrlLink();
+ str = xstrappend(str, l.url_.toUtf8().data());
str = xstrappend(str, "\n");
} else {
str = xstrdup("");
id = atoi(ap[1]);
xasprintf(&wpt_tmp->shortname, "N%05X", id);
- wpt_tmp->url = QString(NC_URL) + QString::number(id);
+ UrlLink l(QString(NC_URL) + QString::number(id));
+ wpt_tmp->AddUrlLink(l);
} else if (0 == strcmp(ap[0], "name")) {
wpt_tmp->description = xstrdup(ap[1]);
} else if (0 == strcmp(ap[0], "user_name")) {
wpt->longitude = shp->dfXMin;
wpt->shortname = xstrdup(name);
if (url) {
- wpt->url = xstrdup(url);
+ UrlLink l(url);
+ wpt->AddUrlLink(l);
}
waypt_add(wpt);
break;
*/
holder = csv_stringtrim(s, "", 0);
if (strstr(holder, "http:") != NULL) {
- wpt_tmp->url = holder;
+ UrlLink link(holder);
+ wpt_tmp->AddUrlLink(link);
}
xfree(holder);
break;
/* Number of characters */
/* 25 6 80 8 8 8 8 8 4 4 128 */
+ const char *l;
+ if (wpt->HasUrlLink()) {
+ UrlLink link = wpt->GetUrlLink();
+ l = link.url_.toUtf8().data();
+ } else {
+ l = "";
+ }
gbfprintf(file_out, "new\t%.6s\t%.80s\t%08.6f\t%08.6f\t\t\t%.2f\t%d\t%d\t%.128s\n",
shortname,
description,
wpt->altitude,
colour,
icon,
- wpt->hasLink() ? wpt->url.toUtf8().data() : ""
+ l
);
notes[0] = '\0';
gbfread(notes, 1, name_length, tpo_file_in);
notes[name_length] = '\0'; // Terminator
- waypoint_temp->url = notes;
+ UrlLink l(notes);
+ waypoint_temp->AddUrlLink(l);
//printf("Notes: %s\n", notes);
xfree(notes);
}
notes[0] = '\0';
gbfread(notes, 1, name_length, tpo_file_in);
notes[name_length] = '\0'; // Terminator
- waypoint_temp->url = notes;
+ UrlLink l(notes);
+ waypoint_temp->AddUrlLink(l);
//printf("Notes: %s\n", notes);
xfree(notes);
}
wpt->notes = xstrdup(s);
break;
- case fld_url:
- wpt->url = xstrdup(s);
+ case fld_url: {
+qDebug() << s;
+ UrlLink l(s);
+ wpt->AddUrlLink(l);
+ }
break;
case fld_altitude:
gb_setbit(&unicsv_outp_flags, fld_notes);
}
}
- if (wpt->hasLink()) {
+ if (wpt->HasUrlLink()) {
gb_setbit(&unicsv_outp_flags, fld_url);
}
if (wpt->creation_time.isValid()) {
gbfputs(unicsv_fieldsep, fout);
}
}
- if FIELD_USED(fld_url) {
- unicsv_print_str(wpt->url);
+ if (FIELD_USED(fld_url)) {
+ if (!wpt->HasUrlLink()) {
+ unicsv_print_str("");
+ } else {
+ UrlLink l = wpt->GetUrlLink();
+ unicsv_print_str(l.url_);
+ }
}
if FIELD_USED(fld_garmin_facility) {
gbfprintf(file_out, "N:%s;%s;;;\n", wpt->description,wpt->shortname);
gbfprintf(file_out, "ADR:%c%d %06.3f %c%d %06.3f\n", wpt->latitude < 0 ? 'S' : 'N', abs(latint), 60.0 * (fabs(wpt->latitude) - latint), wpt->longitude < 0 ? 'W' : 'E', abs(lonint), 60.0 * (fabs(wpt->longitude) - lonint));
- if (wpt->hasLink()) {
- gbfprintf(file_out, "URL:%s\n", wpt->url.toUtf8().data());
+ if (wpt->HasUrlLink()) {
+ UrlLink link = wpt->GetUrlLink();
+ gbfprintf(file_out, "URL:%s\n", link.url_.toUtf8().data());
}
gbfprintf(file_out, "NOTE:");
tmp->notes = xstrdup(wpt->notes);
}
- tmp->url = (wpt->url);
- tmp->url_link_text = wpt->url_link_text;
-
- for (url_link* url_next = wpt->url_next; url_next; url_next = url_next->url_next) {
- waypt_add_url(tmp, url_next->url, url_next->url_link_text);
- }
-
tmp->icon_descr = wpt->icon_descr;
if (wpt->gc_data != &empty_gc_data) {
void
waypt_add_url(waypoint *wpt, const QString& link, const QString& url_link_text)
{
- if ((link == NULL) && (url_link_text == NULL)) {
- return;
- }
-
- /* Special case first one; it goes right into the waypoint. */
- if ((wpt->url == NULL) && (wpt->url_link_text == NULL)) {
- wpt->url = link;
- wpt->url_link_text = url_link_text;
- } else {
- url_link *tail;
- url_link *new_link = new url_link;
- new_link->url = link;
- new_link->url_link_text = url_link_text;
-
- /* Find current end of chain and tack this onto the end.. */
- for (tail = wpt->url_next;; tail = tail->url_next) {
- if (tail == NULL) {
- wpt->url_next = new_link;
- break;
- }
- if (tail->url_next == NULL) {
- tail->url_next = new_link;
- break;
- }
- }
- }
+ wpt->url_link_list_.push_back(UrlLink(link, url_link_text));
}
double